#define GROUP_WIDTH  (1000)
#define GROUP_HEIGHT (1)
#define GROUP_DEPTH  (1)

cbuffer cbImmutable : register (b0) {
	uint gDispatchGroupsY;
};

RWStructuredBuffer<float4> gEntitiesCenterPosW : register(u0);
RWStructuredBuffer<float4> gEntitiesVelW : register(u1);

[numthreads(GROUP_WIDTH, GROUP_HEIGHT, GROUP_DEPTH)]
void
main(in const uint3 dispatchThreadId : SV_DispatchThreadID) {
	// We do not use Z coordinate in num threads or dispatch thread.
	// Then index will be iIndex * J + jIndex
	const uint index = dispatchThreadId.x * gDispatchGroupsY + dispatchThreadId.y;

	// Based on current entity center position and velocity,
	// we update its position.
	const float4 oldCenterPosW = gEntitiesCenterPosW[index];
	const float4 velW = gEntitiesVelW[index];
	const float4 newCenterPosW = oldCenterPosW + velW;
	gEntitiesCenterPosW[index] = newCenterPosW;
}